

#include "stdafx.h"
#include "pf_overlaybox.h"

#include "pf_debug.h"
#include "pf_graphicview.h"
#include "pf_painter.h"
#include "pf_graphic.h"
#include <QBrush>

/**
 * Constructor.
 */
PF_OverlayBox::PF_OverlayBox(PF_Container* parent,
                 const PF_OverlayBoxAttribute& d)
        :PF_AtomicEntity(parent), data(d) {
}



/**
 * Destructor.
 */
PF_OverlayBox::~PF_OverlayBox() {}




PF_Entity* PF_OverlayBox::clone() {
    PF_OverlayBox* l = new PF_OverlayBox(*this);
    l->initId();
    return l;
} 

void PF_OverlayBox::draw(PF_Painter* painter, PF_GraphicView* view, double patternOffset) {
    if (painter==NULL || view==NULL) {
        return;
    }
	
	PF_Vector v1=view->toGui(getCorner1());
	PF_Vector v2=view->toGui(getCorner2());
	
	QBrush brush(QColor(9,9,255,90));
	painter->fillRect(v1.x, v1.y, v2.x-v1.x, v2.y-v1.y, QColor(9,9,255,90) );
	

}


/**
 * Dumps the point's data to stdout.
 */
std::ostream& operator << (std::ostream& os, const PF_OverlayBox& l) {
    os << " Line: " << l.getData() << "\n";
    return os;
}


